
// Source File Name:   ReferenceModifier.java

package com.sunwayhorizo.health.hl7.factories;

import com.sunwayhorizo.health.hl7.common.VersionInfo;

import java.io.ObjectStreamException;
import java.io.Serializable;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;


public final class ReferenceModifier
    implements Comparable, Serializable
{

    public static final String RCS_ID = "$Header: ReferenceModifier.java 1.0 2006/08/26 11:02:10 amchanda noship $";
    public static final boolean RCS_ID_RECORDED = VersionInfo.recordClassVersion("$Header: ReferenceModifier.java 1.0 2005/08/26 11:02:10 amchanda noship $", "package com.sunwayhorizo.health.facade.factories;");
    public static final ReferenceModifier CREATE_IF;
    public static final ReferenceModifier CREATE_OR_OVERLAY;
    public static final ReferenceModifier MUST_EXIST;
    public static final ReferenceModifier OVERLAY;
    public static final ReferenceModifier UPDATE;
    public static final ReferenceModifier CREATE_OR_UPDATE;
    private static final ReferenceModifier fValues[];
    public static final List VALUES;
    private final transient String fName;
    private static int fNextValue;
    private final int fValue;

    private ReferenceModifier(String s)
    {
        fValue = fNextValue++;
        fName = s;
    }

    public int compareTo(Object obj)
    {
        return fValue - ((ReferenceModifier)obj).fValue;
    }

    public String toString()
    {
        return fName + " = " + fValue;
    }

    public int getValue()
    {
        return fValue;
    }

    Object readResolve()
        throws ObjectStreamException
    {
        return fValues[fValue];
    }

    static 
    {
        CREATE_IF = new ReferenceModifier("CREATE_IF");
        CREATE_OR_OVERLAY = new ReferenceModifier("CREATE_OR_OVERLAY");
        MUST_EXIST = new ReferenceModifier("MUST_EXIST");
        OVERLAY = new ReferenceModifier("OVERLAY");
        UPDATE = new ReferenceModifier("UPDATE");
        CREATE_OR_UPDATE = new ReferenceModifier("CREATE_OR_UPDATE");
        fValues = (new ReferenceModifier[] {
            CREATE_IF, CREATE_OR_OVERLAY, MUST_EXIST, OVERLAY, UPDATE, CREATE_OR_UPDATE
        });
        VALUES = Collections.unmodifiableList(Arrays.asList(fValues));
    }
}
